#!../../../common/bats/bin/bats
# -*-sh-*-

load ./common/test_helper_functions || exit 1
source ./common/functions || exit 1

if [ -s ./common/TEST_ENV ];then
    source ./common/TEST_ENV
fi

check_rms
rm=$RESOURCE_MANAGER

testname="libs/ScaLAPACK"

NODES=2
TASKS=8
ARGS=0

@test "[$testname/PCSCAEX] CPCGESV under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    if [ ! -s pcscaex ];then
	flunk "pcscaex binary does not exist"
    fi

    run_mpi_binary ./pcscaex $ARGS $NODES $TASKS
    assert_success
}

@test "[$testname/PDSCAEX] DPCGESV under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    if [ ! -s pdscaex ];then
	flunk "pdscaex binary does not exist"
    fi

    run_mpi_binary ./pdscaex $ARGS $NODES $TASKS
    assert_success
}

@test "[$testname/PSSCAEX] SPCGESV under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    if [ ! -s psscaex ];then
	flunk "psscaex binary does not exist"
    fi

    run_mpi_binary ./psscaex $ARGS $NODES $TASKS
    assert_success
}

@test "[$testname/PZSCAEX] ZPCGESV under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    if [ ! -s pzscaex ];then
	flunk "pzscaex binary does not exist"
    fi

    run_mpi_binary ./pzscaex $ARGS $NODES $TASKS
    assert_success
}

